﻿using MQTTnet;
using MQTTnet.Client.Receiving;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace MqttServer
{
    public class ApplicationMessageHandler : IMqttApplicationMessageReceivedHandler
    {
        public async Task HandleApplicationMessageReceivedAsync(
            MqttApplicationMessageReceivedEventArgs eventArgs)
        {
            string message = System.Text.ASCIIEncoding.UTF8.GetString(eventArgs.ApplicationMessage.Payload);
            Console.WriteLine(message);
            await Task.CompletedTask;
        }
    }
}
